package com.thread.executor;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class ExecutorTest {

    public static void main(String[] args) {

        ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(5
                ,10
                ,100
                , TimeUnit.SECONDS
                ,new ArrayBlockingQueue(1));
        threadPoolExecutor.execute(new Runnable() {
            @Override
            public void run() {
                System.out.println("-------------------");
            }
        });
        threadPoolExecutor.getTaskCount(); //获取线程已经执行与未执行的任务总数
        threadPoolExecutor.getCompletedTaskCount();
        threadPoolExecutor.getPoolSize();
        threadPoolExecutor.getActiveCount();

    }

}
